Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/189549/13/45489/36744/664c6b60F2874fd8b/015ea59b73a7c732.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/248808/35/4895/22642/65dd566fFf2f37ad0/d86d28f8d44142fb.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/176571/10/38628/37378/65dd54b5F7016a4bb/bd1b6717244e5374.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/137458/15/42018/85076/65dd54b5F598040f0/6b7541f04e1302a3.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/246728/29/4772/159361/65dd54b5F079e86c4/ccff01a65a4e9581.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/231033/24/4882/80995/6566eeafF1e0285bb/79d63a75bc20e546.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/195953/39/40395/51245/6566eeadF3e0fb059/1ecae37df8a8699e.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/230378/22/5052/36016/6566eeabFa55343b1/8a57e9adde9a200e.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/181219/21/41675/31614/6566eea9Fe8ad8a40/30d4696d80253a0a.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/233380/38/4526/35093/6566eea6Fc8b7091a/728d8a52e82cea2c.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/232900/26/5040/42794/6566eea4F84376d32/e358c1a232b3c5d8.jpg.avif",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})
